package com.itany;

import java.util.Arrays;

/**
 * Author：汤小洋
 * Date：2022-10-26 10:34
 * Description：<描述>
 */
public class Test04_Lambda应用 {
    public static void main(String[] args) {
        /**
         * 应用1
         */
        Integer[] nums = {12, 43, 2354, 7, 34, 8, 22};

        // Arrays.sort(nums);

        // Arrays.sort(nums, new Comparator<Integer>() {
        //     @Override
        //     public int compare(Integer o1, Integer o2) {
        //         return o2 - o1;
        //     }
        // });

        Arrays.sort(nums, (o1,o2) -> o2-o1);

        System.out.println(Arrays.toString(nums));


        /**
         * 应用2
         */
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("Test04_Lambda应用.run");
            }
        });

        Thread t2 = new Thread(() -> {
            System.out.println("Test04_Lambda应用.main");
            System.out.println("Test04_Lambda应用.main");
            System.out.println("Test04_Lambda应用.main");
        });




    }
}
